package crl.lottery.view
{
	import flash.display.DisplayObject;
	
	import org.aswing.ASColor;
	import org.aswing.Component;
	import org.aswing.JFrame;
	import org.aswing.JOptionPane;
	import org.aswing.StyleTune;

	public class NoticeManager
	{
		public function NoticeManager()
		{
		}
		
		public static function alert(title:String, msg:String, finishHandler:Function=null,buttons:int=1):JFrame{
			var panel:JOptionPane=JOptionPane.showMessageDialog(title,msg,finishHandler,null,true,null,buttons);
			panel.getFrame().getModalMC().alpha=.3
			panel.getOkButton().setText("确定");
			//panel.getCancelButton().setText("取消");
			panel.getNoButton().setText("取消");
			panel.pack();
			
			var frame:JFrame=panel.getFrame();
			var c:Component=frame.getTitleBar().getSelf();
			c.setForeground(new ASColor(0xffffff));
			c.setMideground(new ASColor(0xFFFFFF));
			
			frame.setMideground(new ASColor(0x333333));
			
			var style:StyleTune=frame.getStyleTune();
			style.round=5;
			style.mide.round=5;
			frame.setStyleTune(style);
			frame.invalidate();
			return frame;
		}
		
		private static var lalert:LAlert;
		public static function lotteryAlert(title:String, msg:String, finishHandler:Function=null,buttons:int=1):DisplayObject{
			if(lalert==null){
				lalert=new LAlert();
			}
			lalert.message=msg;
			lalert.finishHandler=finishHandler;
			
			lalert.show();
			return lalert;
		}
		
		
	}
}